package org.example.serviceImpl;

import org.example.test1.mapper.EmpMapper1;
import org.example.pojo.Emp;
import org.example.service.EmpService;
import org.example.test2.mapper.EmpMapper2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *@ClassName: EmpServiceImpl
 *@Author: CJ
 *@Date: 2021-9-2 10:40
 */
@Service
public class EmpServiceImpl implements EmpService {

    @Autowired
    private EmpMapper1 empMapper1;

    @Autowired
    private EmpMapper2 empMapper2;

    @Override
    public int addEmp(Emp emp) {
        return empMapper1.insert(emp);
    }

    @Override
    public Emp selectEmpById(Integer id) {
        return empMapper2.selectByPrimaryKey(id);
    }

    @Override
    public List<Emp> selectAll() {
        return empMapper2.findAll();
    }
}
